﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace Upreader.Presentation.Client.ViewModel.Common
{
    /// <summary>
    /// Helpers for tracking a task and allowing it to be cancelled from a single place
    /// </summary>
    class TaskWithCancellationTokenSource
    {
        public TaskWithCancellationTokenSource(Task task, CancellationTokenSource cancellationTokenSource)
        {
            if (task == null)
                throw new ArgumentNullException("task");
            if (cancellationTokenSource == null)
                throw new ArgumentNullException("cancellationTokenSource");
            
            Task = task;
            CancellationTokenSource = cancellationTokenSource;
        }

        public Task Task { get; private set; }

        public CancellationTokenSource CancellationTokenSource { get; private set; }
    }
}
